<?php

header('content-type:text/html;charset=utf8');
$account=$_POST['account'];
$pwd=$_POST['pwd'];
session_start();
$_SESSION["account"]="$account";
//var_dump($_SESSION["account"]);die;

$link =@mysql_connect('127.0.0.1','root','root');
if(!$link){
    die('连接失败，错误号为：'.mysql_errno().'失败原因：'.mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "select * from member where `account`='".$account."' && `pwd`='".$pwd."'";
$res = mysql_query($sql);
$arr = array();
while ($row = mysql_fetch_assoc($res)){
    $arr[] = $row;
}

//var_dump($row);die;
//$arr=$arr[0];
if(empty($arr)){
    echo '<script>alert("登录失败，账户或密码错误");window.location.href="/qiantai/denglu.php"</script>';
}else{
    
    echo '<script>alert("登录成功");window.location.href="/qiantai/index.php"</script>';

}
mysql_free_result($res);
mysql_close();
?>